package com.wlsk.license.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.Collections;
import java.util.List;

/**
 * 分页查询响应dto
 *
 * @param <T>
 */
@Setter
@Getter
@ApiModel(value = "分页响应信息")
public class PageResultDto<T> extends BaseDto {

    @ApiModelProperty(value = "数据集合", required = true)
    private List<T> content;

    @ApiModelProperty(value = "当前页码", required = true)
    private long pageNum;

    @ApiModelProperty(value = "每页显示条数", required = true)
    private long pageSize;

    @ApiModelProperty(value = "总记录数", required = true)
    private long totalCount;

    @ApiModelProperty(value = "总页数", required = true)
    private long totalPages;

    public PageResultDto() {
    }

    public PageResultDto(long page, long size, long totalCount, long totalPages) {
        this.pageNum = page;
        this.pageSize = size;
        this.totalCount = totalCount;
        this.totalPages = totalPages;
        this.content = Collections.emptyList();
    }

    public PageResultDto(List<T> content, long page, long size, long totalCount, long totalPages) {
        this.content = content;
        this.pageNum = page;
        this.pageSize = size;
        this.totalCount = totalCount;
        this.totalPages = totalPages;
    }
}